<?php

class Form_Comment extends Zend_Form {
	
	public function __construct($item_id = null)
	{
		parent::__construct();
		$this->setName('comment');
		$message = new Zend_Form_Element_Textarea('message',array('class'=>'pole-t','cols'=>'70','rows'=>'10'));
		$item_id = new Zend_Form_Element_Hidden('item_id', array('value'=>$item_id));
		$submit = new Zend_Form_Element_Image('submit', array('class'=>'answ', 'src'=>'/images/answer.gif', ));
		$user = new Zend_Form_Element_Hidden('user_id');
		if(Zend_Auth::getInstance()->hasIdentity())
		{
			$user->setValue(Zend_Auth::getInstance()->getIdentity()->id);
		} else {
			$user->setValue(0);
		}
		$this->addElements(array($message, $item_id, $user,$submit));
		
		foreach($this->getElements() as $element){
        	$element->clearDecorators()->addDecorator("ViewHelper")
        	->addDecorator("Errors");
        }
	}
}
?>